Skip to content

feat(driver): multishot op#715

Merged
George-Miao merged 16 commits into
compio-rs:masterfrom
Berrysoft:dev/driver-multishot
Mar 5, 2026
Merged

feat(driver): multishot op#715
George-Miao merged 16 commits into
compio-rs:masterfrom
Berrysoft:dev/driver-multishot

Conversation

@Berrysoft
Copy link
Copy Markdown
Member

Related: #104

@Berrysoft Berrysoft requested a review from Copilot February 27, 2026 18:46
@Berrysoft Berrysoft self-assigned this Feb 27, 2026
@Berrysoft Berrysoft added enhancement New feature or request driver: io-uring About the io-uring driver package: driver Related to compio-driver labels Feb 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements multishot opcode support for io_uring operations, addressing issue #104. Multishot operations allow a single submission to generate multiple completion events, which is useful for operations like reading multiple buffers or receiving multiple network packets without resubmitting the operation each time.

Changes:

  • Adds three new multishot operations: ReadMultiAt, ReadMulti, and RecvMulti that can produce multiple completion results from a single submission
  • Implements a fallback mechanism via create_entry_fallback() to gracefully handle unsupported opcodes by falling back to single-shot operations
  • Introduces pop_multishot() API to retrieve intermediate results from multishot operations before the final completion

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
compio-driver/tests/file.rs Adds test cases for multishot read and recv operations, including new test helper push_and_wait_multi
compio-driver/src/sys/stub/mod.rs Provides stub implementation of pop_multishot returning None
compio-driver/src/sys/poll/mod.rs Provides polling driver implementation of pop_multishot returning None (no multishot support)
compio-driver/src/sys/iour/op.rs Implements the three new multishot operation types with fallback to single-shot managed operations, and refactors code with take_buffer helper
compio-driver/src/sys/iour/mod.rs Core multishot support including result queue management, completion handling with more flag detection, and fallback logic
compio-driver/src/sys/iocp/mod.rs Provides IOCP driver stub for pop_multishot returning None
compio-driver/src/sys/fusion/op.rs Adds macro invocations for the three multishot operations in fusion driver
compio-driver/src/sys/fusion/mod.rs Delegates pop_multishot calls to underlying driver and exports take_buffer helper
compio-driver/src/op.rs Exports new multishot operations and implements ResultTakeBuffer for BufResult<usize, Extra> to support buffer extraction
compio-driver/src/lib.rs Adds public pop_multishot method to Proactor API
compio-driver/src/key.rs Adds wake_by_ref method to FrozenKey for waking tasks without consuming the key

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread compio-driver/src/sys/fusion/op.rs Outdated
Comment thread compio-driver/src/sys/iour/mod.rs Outdated
Comment thread compio-driver/src/sys/iour/op.rs
Comment thread compio-driver/src/sys/iour/op.rs Outdated
Comment thread compio-driver/tests/file.rs
Comment thread compio-driver/src/sys/iour/mod.rs
@Berrysoft
Copy link
Copy Markdown
Member Author

Oh, no. #716 only handles ReadMulti, but cannot handle SendMulti or AcceptMulti, as the opcode are the same for oneshot/multishot ops. There's no way to probe.

@Berrysoft Berrysoft force-pushed the dev/driver-multishot branch from d18f270 to 7dd2a07 Compare February 28, 2026 03:17
@Berrysoft Berrysoft marked this pull request as ready for review February 28, 2026 03:17
Comment thread compio-driver/src/sys/iour/mod.rs Outdated
Comment thread compio-driver/src/key.rs Outdated
Comment thread compio-driver/src/sys/iour/mod.rs Outdated
Comment thread compio-driver/src/sys/iour/mod.rs Outdated
@Berrysoft Berrysoft requested a review from George-Miao March 3, 2026 08:28
@Berrysoft Berrysoft force-pushed the dev/driver-multishot branch from 1bdf588 to 5310f37 Compare March 3, 2026 15:41
Comment thread compio-driver/src/sys/iour/mod.rs Outdated
@Berrysoft Berrysoft force-pushed the dev/driver-multishot branch from 9d42c2c to 8d82135 Compare March 3, 2026 15:51
@Berrysoft Berrysoft requested a review from George-Miao March 3, 2026 15:51
@Berrysoft Berrysoft requested review from George-Miao and removed request for George-Miao March 3, 2026 16:15
@Berrysoft Berrysoft mentioned this pull request Mar 4, 2026
10 tasks
need_push_notifier: bool,
multishot_results: BTreeMap<usize, VecDeque<CEntry>>,
_local_marker: PhantomData<ErasedKey>,
multishot_results: HashMap<ErasedKey, VecDeque<CEntry>>,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can implement Ord for ErasedKey if you prefer BTreeMap.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either one is OK.

Copy link
Copy Markdown
Member

@George-Miao George-Miao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@George-Miao George-Miao merged commit 23a60f8 into compio-rs:master Mar 5, 2026
63 checks passed
@Berrysoft Berrysoft deleted the dev/driver-multishot branch March 5, 2026 18:56
@github-actions github-actions Bot mentioned this pull request Mar 5, 2026
@Berrysoft Berrysoft added this to the v0.19 milestone Mar 11, 2026
This was referenced Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

driver: io-uring About the io-uring driver enhancement New feature or request package: driver Related to compio-driver

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants